// pages/doctor-my-course/doctor-my-course.js
var app=getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    doctorId: '',      // 医生id
    pagesize: '',      // 显示多少行
    page: '',          // 页数
    imgUrl: app.globalData.imgUrl, //请求接口图片路径
    list: '',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getCourseList();
  
  },

  // 获取课程列表
  getCourseList(){
    const that = this;
    const param = {
      doctorId: wx.getStorageSync('userid'),
      pagesize: 5,
      page: 0
    };
    app.request({
      url: "/doctor/doctor/getDoctorCourse",
      data: param,
      success: function (res) {
        that.setData({
          list: res.data
        });
      },
      fail: function (res) {
        // app.requestFail(res);
      }
    });
  },

  //进入详情
  entryCourse(e){
    const id = e.currentTarget.dataset.id;
    const classify = e.currentTarget.dataset.classify;
    const obj = {
      id,
      classify
    }
    wx.navigateTo({
      url: "../doctor-train-details/doctor-train-details?obj=" + JSON.stringify(obj)
    });
    
  }

})